<?php

namespace App\Api\Dao;

use App\Models\TongGoodsCate;

class GoodsCateDao extends BaseDao
{

    /**
     * 获取分类列表
     * @param array $array
     * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|void
     */
    public function getCateList(array $array)
    {
        return $this->getBuildQuery($array)->get();
    }

    /**
     * @param $data
     * @return \Illuminate\Database\Eloquent\Builder
     */
    function getBuildQuery($data)
    {
        // TODO: Implement getBuildQuery() method.
        $query = TongGoodsCate::query();
        if(checkIsHasField($data,'id')){
            $query->where('id',$data['id']);
        }
        return $query;
    }
}
